<%@ page language="java" contentType="text/html; charset=utf-8" import="java.sql.*" errorPage=""%>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    .title {
        font-size: 35px;
        margin-top: 50px;
        text-align: center;
    }
    .but {
        margin-top: 20px;
        text-align: center;
    }
    a {
				text-decoration: none;
				color: black;
		}
		a:hover {
				color:green;
			}
		tr {
			background-color: rgb(204, 255, 255);
			}
		td {
			width:100px;
			text-align: center;
			}
		.a1 {
			background-color: rgb(255, 255, 0)!important;
			}
			
		input {
				display: none;
				}
				
		.del {
			color: red;
			}
			.upa {
			color: blue;
				}
    
</style>
<body>
	<%@ include file="inc.jsp" %>
	<jsp:useBean id="LogBean" scope="session" class="Bean.dbConn"/>
    <div class="title">测试者列表</div>
     <table border="1" align="center">
            <tr class="a1">
                <td>序号</td>
                <td>学号</td>
                <td>姓名</td>
                <td>测试内容</td>
                <td>处理操作</td>
                <td>修改</td>
            </tr>
    <%
    ResultSet rs = null;
    int i = 1;
    rs = LogBean.executeQuery("SELECT * FROM user");
    while(rs.next()) {
    ResultSet rb = null;
    String temp2 = "";
    out.print("<tr><td>" + i + "</td>");
		out.print("<td>" + rs.getString("number") + "</td>");
		out.print("<td>" + rs.getString("name") + "</td>");
		rb = LogBean.executeQuery("SELECT * FROM testleixin where myid=" + "'" + rs.getString("id") + "'");
	while(rb.next()) {
	temp2 += rb.getString("testtype") + " ";
	}
	out.print("<td><form action='testin.jsp' method='POST' name='myfrom' id='myfrom' ><input type='text' name='myid' value='" + rs.getString("id") +"'><a href='#'>" + temp2 + "</a></form></td>");
	out.print("<td><form action='delet.jsp' method='POST' name='myfrom' id='myfrom' ><input type='text' name='myid' value='" + rs.getString("id") +"'><a href='#' class='del'>删除</a></form></td>");
	out.print("<td><form action='update.jsp' method='POST' name='myfrom' id='myfrom' ><input type='text' name='myid' value='" + rs.getString("id") +"'><input type='text' name='myid1' value='" + rs.getString("number") +"'><input type='text' name='myid2' value='" + rs.getString("name") +"'><input type='text' name='myid3' value='" + rs.getString("sex") +"'><input type='text' name='myid4' value='" + rs.getString("class") +"'><input type='text' name='myid5' value='" + rs.getString("bri") +"'><input type='text' name='myid6' value='" + rs.getString("bril") +"'><a href='#' class='upa'>修改测试者信息</a></form></td></tr>");
		i++;
    }
    %>
    </table>
    
    <div class="but">
        <a href="../login.html" target="_blank">
            <button>返回登录页面</button>
        </a>
    </div>
    
    <script>
    	let click = document.querySelectorAll('a');
    	let myfrom = document.querySelectorAll('#myfrom');
    	for (let i = 0; i < click.length; i++) {
    		click[i].onclick = function() {
    			myfrom[i].submit()
    			}
    		}
    	
    </script>
</body>
</html>